package com.wuhao.shootclient.util;

/**
 * Create by hao on 2019-11-26
 */
public class NoFastClickUtils {


    private static long lastClickTime = 0;//上次点击的时间

    private static int spaceTime = 300;//时间间隔

    public static boolean isFastClick(int spacetime) {
        spaceTime =spacetime;
        long currentTime = System.currentTimeMillis();//当前系统时间

        boolean isAllowClick;//是否允许点击

        if (currentTime - lastClickTime > spaceTime) {
            isAllowClick = false;
        } else {
            isAllowClick = true;
            lastClickTime = currentTime;
        }
        return isAllowClick;
    }

}
